package cn.igroup.server.nio.event;

import sun.misc.Signal;
import sun.misc.SignalHandler;

/**
 * @author LONG
 * @date 2018/1/5 17:59
 */
public class SystemShutdown implements SignalHandler {
    @Override
    public void handle(Signal signal) {
        System.out.print("--------------SystemShutdown-----------------");
        Thread t = new Thread(new ShutdownHook(), "ShutdownHook-Thread");
        Runtime.getRuntime().addShutdownHook(t);
        Runtime.getRuntime().exit(0);
    }
}
